<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>生成器函数实战2</title>
</head>
<body>
	
	<script>
		function one(){
			setTimeout(function(){
				let data = '用户名称';
				str.next(data);
			}, 1000)
		}

		function two(){
			setTimeout(function(){
				let data = '订单详情';
				str.next(data);
			}, 1000)
		}

		function three(){
			setTimeout(function(){
				let data = '商品数据';
				str.next(data);
			}, 1000)
		}

		function * gen(){
		    let users =	yield one();
		    console.log(users);
			let orders = yield two();
		    console.log(orders);
			let goods = yield three();
		    console.log(goods);
		}

		let str = gen();
		str.next();
	</script>
</body>
</html>